package com.itheima;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @auther Macrydy
 * @date 2020/7/9 15:22
 */
public class Demo1 {
    public static void main(String[] args) {

        MyAtomThread mt = new MyAtomThread();
        Thread t1 = new Thread(mt,"一号");
        Thread t2 = new Thread(mt,"二号");
        t1.start();
        t2.start();
    }
}
class MyAtomThread implements Runnable{

    AtomicInteger ac = new AtomicInteger(0);

    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            ac.incrementAndGet();
            System.out.println(Thread.currentThread().getName()+"=======>"+ac);
        }

    }
}